const menu={
    state:{
        tabsList: [
            {
                url: '/home',
                name: '主页',
                menuId:'1',
            }
        ],
        editableTabsValue:'主页'
    },
    mutations: {
        ADD_TAG: (state, tag) => {
            let judge = true
            state.tabsList.forEach((item)=>{//如果已经添加tag，则不添加
                if(item.name===tag.name){
                    judge=false
                }
            })
            if(judge)
                state.tabsList.push(tag)
            state.editableTabsValue = tag.name
        },
        CHANGE_TAGS_VALUES: (state, val) => {
            state.editableTabsValue = val;
        },
        CHANGE_TAG:(state,tag)=>{
            state.tabsList=tag
        },
        INIT_TAG:(state)=> {
            state.tabsList = [{
                url: '/home',
                name: '主页',
                menuId: '1',
            }]
            state.editableTabsValue='home'
        }
    }

}
export default menu;
